package com.zbkj.dal.pojo.response;

import com.zbkj.dal.base.constants.DateConstants;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.experimental.Accessors;
import org.springframework.format.annotation.DateTimeFormat;

import java.io.Serializable;
import java.math.BigDecimal;
import java.time.LocalDateTime;
import java.util.Date;
import java.util.List;

/**
 * 订单移动端列表数据响应对象
 * +----------------------------------------------------------------------
 * | CRMEB [ CRMEB赋能开发者，助力企业发展 ]
 * +----------------------------------------------------------------------
 * | Copyright (c) 2016~2023 https://www.crmeb.com All rights reserved.
 * +----------------------------------------------------------------------
 * | Licensed CRMEB并不是自由软件，未经许可不能去掉CRMEB相关版权
 * +----------------------------------------------------------------------
 * | Author: CRMEB Team <admin@crmeb.com>
 * +----------------------------------------------------------------------
 */
@Data
@EqualsAndHashCode(callSuper = false)
@Accessors(chain = true)
@ApiModel(value = "OrderFrontDataResponse对象", description = "订单移动端列表数据响应对象")
public class OrderFrontDataResponse implements Serializable {

    private static final long serialVersionUID = 1387727608277207652L;

    @ApiModelProperty(value = "订单id")
    private Integer id;

    @ApiModelProperty(value = "订单号")
    private String orderNo;

    @ApiModelProperty(value = "商户ID")
    private Integer merId;

    @ApiModelProperty(value = "支付状态")
    private Boolean paid;

    @ApiModelProperty(value = "支付时间")
    private Date payTime;

    @ApiModelProperty(value = "支付日期", example = "2024-02-02")
    private String payDate;

    @ApiModelProperty(value = "支付金额")
    private BigDecimal payPrice;

    /**
     * @see com.zbkj.dal.base.enums.OrderStatusEnums
     */
    @ApiModelProperty(value = "买入订单（0：待支付，1：待发货 4：待收货 5：已收货 6：已完成 9:已取消）")
    private Integer status;

    /**
     * @see com.zbkj.dal.base.enums.OrderStatusEnums
     */
    //    @ApiModelProperty(value = "承享状态（0：待支付，1：待发货 4：待收货 5：已收货 7.承享中 8.待归还 10:验收中 11:已超时 12:无法验收）")
    @ApiModelProperty(value = "承享订单（200:用户待支付 202:商户待发货  204:用户待收货 205:用户待签收  206:用户承享中 208:用户承享待归还 210:待贝贝奢护收货 212:贝贝奢护验收中 214:订单已经完成 251:承享已经超时 253:订单无法回收）", notes = "此字段只是用来展示链路变化, 不会实际赋值，直接使用status")
    private Integer rentStatus;

    @ApiModelProperty(value = "取消状态：0-未取消，1-系统取消，2-用户取消")
    private Integer cancelStatus;

    @ApiModelProperty(value = "订单商品总数")
    private Integer totalNum;

    @ApiModelProperty(value = "商品总价")
    private BigDecimal proTotalPrice;

    @ApiModelProperty(value = "订单总价")
    private BigDecimal totalPrice;

    @ApiModelProperty(value = "支付邮费")
    private BigDecimal payPostage;

    @ApiModelProperty(value = "优惠券金额")
    private BigDecimal couponPrice;

    @ApiModelProperty(value = "积分抵扣金额")
    private BigDecimal integralPrice;

    @ApiModelProperty(value = "订单详情对象列表")
    private List<OrderInfoFrontDataResponse> orderInfoList;

    @ApiModelProperty(value = "商户名称")
    private String merName;

    @ApiModelProperty(value = "订单类型:0-普通订单，10-承享订单")
    private Integer type;

    /**
     * @see com.zbkj.dal.base.enums.OrderDeliveryType
     */
    @ApiModelProperty(value = "发货方式", example = "delivery")
    private String deliveryType;

    @ApiModelProperty(value = "发货方式", example = "快递到家")
    private String deliveryTypeDesc;

    @ApiModelProperty("当前承享信息")
    private OrderFrontRentRecord currentRent;

    @ApiModelProperty("创建时间")
    @DateTimeFormat(pattern = DateConstants.DATE_FORMAT)
    private LocalDateTime createTime;

    @ApiModelProperty("是否能退款 0-否/1-是")
    public Integer canRefund;

    @Data
    public static class OrderFrontRentRecord {
        @ApiModelProperty("承享天数")
        private Integer rentDays;

        @ApiModelProperty("承享开始日期")
        @DateTimeFormat(pattern = DateConstants.DATE_FORMAT)
        private LocalDateTime rentStartDate;

        @ApiModelProperty("承享结束日期")
        @DateTimeFormat(pattern = DateConstants.DATE_FORMAT)
        private LocalDateTime rentEndDate;

        @ApiModelProperty("剩余天数")
        private Long remainingDays;

        @ApiModelProperty("承享归还日期")
        @DateTimeFormat(pattern = DateConstants.DATE_FORMAT)
        private LocalDateTime rentReturnDate;

        @ApiModelProperty("承享宽容开始时间")
        @DateTimeFormat(pattern = DateConstants.DATE_FORMAT)
        private LocalDateTime expiredStartDate;

        @ApiModelProperty("承享宽容结束时间")
        @DateTimeFormat(pattern = DateConstants.DATE_FORMAT)
        private LocalDateTime expiredEndDate;

        @ApiModelProperty("承享状态  id:正常完成 0:承享就绪中 1:正常承享中 2:已到归还期 3:已经到宽容期 9:超过宽容期")
        private Integer status;
    }
}
